package com.njupt.sellsec.controller;

import com.njupt.sellsec.domain.SecSellMessage;
import com.njupt.sellsec.domain.SellUser;
import com.njupt.sellsec.rabbitmq.MQReceiver;
import com.njupt.sellsec.rabbitmq.MQSender;
import com.njupt.sellsec.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: XJL
 * @Description:
 * @Date: Create in 10:31 2018/8/1
 * @Modified By:
 **/
@Controller
public class MQController {
    @Autowired
    private MQSender mqSender;

/*    @ResponseBody
    @RequestMapping("/mq")
    public Result<String> mq(){
    mqSender.send("Hello MQ");
        return Result.success("Hello word");
    }

    @ResponseBody
    @RequestMapping("/topic")
    public Result<String> topicmq(){
        mqSender.sendTopic1("Hello MQ");
        return Result.success("Hello word");
    }

    @RequestMapping("/fanout")
    @ResponseBody
    public Result<String> fanout(){
        mqSender.sendFanout("fanout....");
        return Result.success("Hello word");
    }

    @RequestMapping("/header")
    @ResponseBody
    public Result<String> header(){

        mqSender.sendHeaders("header hello");
        return Result.success("hello world");
    }*/

/*    @RequestMapping("/message")
    @ResponseBody
    public Result<String> fanout(){
        SecSellMessage message = new SecSellMessage();
        SellUser sellUser = new SellUser();
        sellUser.setId((long) 1111);
        message.setUser(sellUser);
        message.setGoodsId(11);
        mqSender.sendSecSellMessage(message);
        return Result.success("Hello word");
    }*/

}
